import Vue from 'vue'
import VueRouter from 'vue-router'
Vue.use(VueRouter)
// 把下面的代码粘贴到路由模块中对应的位置，即可防止路由报错的问题
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push (location) {
  return originalPush.call(this, location).catch(err => err)
}
//引入组件
import Main from '@/views/Main.vue'
import Home from '@/views/Home.vue'
import About from '@/views/About.vue'
const routes = [
//   { path: '/reg', component: Reg },
//   { path: '/login', component: Login },
// {
//     path: '/',
//     redirect: '/home'
//   },
  {
    path: '/',
    name:"/",
    component: Main,
    redirect: '/home',
    children: [
        { 
            path: '', // 默认子路由
            component: Home 
        },
        { name:"home",path: '/home', component: ()=> import ("@/views/Home.vue") },
        { name:"UrlMode",path: '/UrlMode', component: ()=> import ("@/views/UrlMode.vue") },
        { name:"about",path: '/about', component: ()=> import ("@/views/About.vue") },
        { name:"scop",path: '/scop', component: ()=> import ("@/views/Scop.vue") },
    //   { path: 'user-info', component: UserInfo },
    //   { path: 'user-avatar', component: UserAvatar },
    //   { path: 'user-pwd', component: UserPwd },
    //   { path: 'art-cate', component: ArtCate },
    //   { path: 'art-list', component: ArtList }
    ]
  }
]

const router = new VueRouter({
  routes
})
export default router